home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-0012 / manual.doc < prev    next >
Text File  |  1997-04-16  |  30KB  |  603 lines

  1. 07200000208800
  2. 1
  3. 2page #
  4. F0000000
  5. 9[...................................................]011
  6. ü
  7.  
  8. ëPALETTEMASTER
  9. Ç
  10. ByKevinCowtan
  11.  
  12.  
  13.  
  14. êCONTENTS
  15. Ç
  16. ü                    1.Ç   Introduction.
  17. ü                    2.Ç   GettingStarted.
  18.                     2.1  DrawingFacilities.
  19.                     2.2  ColourSelection.
  20.                     2.3  OtherFacilitiesü
  21.                     3.Ç   AdvancedGraphics.
  22. ü                    4.Ç   Programmers'Guide.
  23.  
  24. Ç
  25. ü1.ÇêINTRODUCTION
  26. Ç
  27.      ArtprogramsarenowfairlycommonontheAtariST,and
  28. thereisacompetitionbetweenvariouscompaniestowritetheart
  29. programwiththegreatestrangeoffacilities.However,in
  30. general,apicturewhichcanbedrawnononeartprogramcanalso
  31. bedrawnonalltheothers,althoughitmaybeeasierormore
  32. difficultdependingonthefacilitiesprovided.PaletteMasteris
  33. different.WithPaletteMasteryoucandrawpicturesthatare
  34. beyondthescopeofotherprograms,orevenloadexisting
  35. picturesandimprovethem.
  36.  
  37.      PaletteMasterisuniqueinthatitallowsyoutodraw
  38. picturesusingmorethantheST'susuallimitof16colourson
  39. thescreenatonetime.Thismeansthatartistscannowproduce
  40. picturesontheSTfarsuperiortothosepreviouslyavailable.
  41. Thesepicturescanthenbeusedinotherprograms,orjustshown
  42. asworksofcomputerart.Inadditiontomakingpicturesmore
  43. colourful,specialgraphicstechniquesallowpicturestobe
  44. improvedinotherways.
  45.  
  46.      Howmanycolourscanyouuseonthescreen?Theoretically,
  47. PaletteMasterallowstheuseofalloftheST's512colourson
  48. thescreenatonce,howevertheprogramisnotwithout
  49. limitations.Theactualnumberofcolourswhichcanbeusefully
  50. usedinapicturegenerallyvariesbetweenabout20and50.The
  51. limitationisthatonly16colourscanbedisplayedonanyscreen
  52. line(ormoreaccurately,anypairofscreenlines).
  53.  
  54.      Whataretheeffectsofthislimitation?Consideraland⑨
  55. scapepicture.Atthetopofthescreentheskyisblue,fading
  56. towardswhiteatthehorizon.Inthebackgroundtherearehills,
  57. andintheforegroundaretreeswiththeirtopssilhouetted
  58. againstthesky.Nowsupposeweuse5shadesofblue/whitefor
  59. thesky.Tofadetowhitewecolourhorizontalbandsofskyin
  60. progressivelylightercolours,andshadetheedgesofthebands
  61. together.Thiswillonlyusetwocoloursatmostonanyscreen
  62. line,astheworstpossiblesituationisalinewheretheedges
  63. oftwobandsareshadedtogether.Thisleavesuswiththeborder
  64. colour,and13shadesofgreenandbrownforthetreetops.Ifwe
  65. wantedcloudsinthesky,4orsoofthesecolourscouldbe
  66. allocatedforthatpurpose.
  67.      Furtherdownthescreen,thehillsappearbetweenthetrees.
  68. Wecanusecolourfortheborder,1colourfortheskybetween
  69. thehills,6coloursforthehillsthemselves,and8coloursfor
  70. thetreesintheforeground.Belowthisthebackgroundcomes
  71. towardstheobserver,andthiscanberepresentedbyprogressi⑨
  72. velylightercoloursfortheground.Atthebottomofthescreen,
  73. 15colourscanbeallocatedfortheground,theplants,andthe
  74. treetrunks.
  75.      Asdescribedabovethispicturewillprobablyuseatleast
  76. 30colours.Withsometouchingup,itcouldeasilyuse40or50,
  77. agreatimprovementonthenormal16.
  78.  
  79. Ç     Iftheartisthadtoconsidereverypicturelikethis,then
  80. drawingusingPaletteMasterwouldbecomeverylaborious.However
  81. nosuchconsiderationisrequired.PaletteMasterhasbeen
  82. writtenspecificallytodoallthesetasksautomatically,sothat
  83. alltheartistneeddoispickoneofthe512coloursanddraw
  84. withit.Theallocationandarrangementofcoloursinthepicture
  85. isalldonebyaroutinecalledthe'AutomaticPaletteManager'
  86. (APM).Asaresultthepackageisextraordinarilysimpletouse,
  87. moresoperhapsthaneventhemoreconventionalartprograms
  88. availablefortheST.
  89.  
  90.      Thebestwaytolearntousethepackageistouseit,so
  91. loaduptheprogramandgothroughthe'GettingStarted'section
  92. ofthismanualtryingoutalltheoptions.
  93.  
  94. 9[...................................................]011
  95. Çü2.ÇêGETTINGSTARTED
  96. Ç
  97.      TousePaletteMaster,youwillneedanAtari520ST/STM/STFM
  98. a1040STF,oraMegaST.YouwillalsoneedaTVorcolour
  99. monitor.
  100.      PutthePaletteMasterdiskinthediskdrive,andturnon
  101. yourmachine.TheGemdesktopshouldappear,withawindow
  102. showingthefilesonthedisk.Doubleclicktheprogramicon
  103. labelled'_PALART.PRG'.Theartprogramwillnowloadfromdisk.
  104.  
  105.      Thescreenwillnowturnblack,andamenuoficonswillbe
  106. drawnatthebottomofthescreen.Thisisthemenubar,andthis
  107. particularsetoficonsiscalledtheMainMenu.Theicons,from
  108. lefttoright,represent:
  109.      1.  Apaintbrush.
  110.      2.  Aspraycan.
  111.      3.   Alinebeingdrawnbyacrosshaircursor.
  112.      4.  Anellipse.
  113.      5.   Acanofpaint,forfillinginadrawing.
  114.      6.   Alettert,fortext.
  115.      7.   Ablockofpicturebeingmoved.
  116.      8.   Amagnifyingglass,fordetailedwork.
  117.      9.   Adisk,forsavingorloadingpictures.
  118.  
  119.      Thelastboxshowsyouwhichcolourisselectedatthe
  120. moment,calledtheworkcolour.Anydrawingyoudoonthescreen
  121. willappearinthiscolour.
  122.      Youwillnoticethattheboxcontainingthepaintbrushis
  123. litupatthemoment.Thepaintbrushisthereforetheselected
  124. option.Ifyouclickoneoftheothericons(i.e.pointthemouse
  125. atitandpresstheleftbutton),thatwillbecometheselected
  126. option.Tryselectingsomeoftheothericons.Thenselectthe
  127. brushagain.
  128.  
  129.      Tousethecurrentoption,allyouhavetodoisclickthe
  130. mouseattheareaabovethemenubar.Ifyouhadthebrush
  131. selected,youwillhavearoundmousecursoronthescreen.Press
  132. theleftmousebutton.Ifyounowmovethemouseyouwillsee
  133. thatithasleftaroundblobonthescreenintheworkcolour.
  134. Ifyouholddowntheleftmousebuttonandmovethemouse,it
  135. willleaveatrailofcolourbehindit.Thisishowyoudrawwith
  136. thebrush.
  137.      Nowpresstherightmousebutton.Themainmenuwill
  138. reappearatthebottomofthescreen.Thebrushshouldstillbe
  139. selected,butthistimeclickitagain.Themainmenuwillbe
  140. replacedbytheBrushMenu.Ontheleftisthebrushicon,to
  141. showyouwhichmenuyouarein.Ontherightistheworkcolour.
  142. Inthemiddleare16brushes,ofdifferentshapesandsizes.The
  143. largeroundbrushontheleftisselected.Clickanotherbrushto
  144. selectit,andthenclickthescreentodrawwithit.
  145.      Ifyoupresstherightbuttonfromamenu,thecolour
  146. selectorscreenwillappear.Thiswillbeexplainedlater,so
  147. presstherightbuttonagaintogettothedrawingscreen,and
  148. oncemoretogetbacktothemainmenu.
  149.  
  150.      Youcanclickanyicontoselectit,butifyouclickthe
  151. currentlyselectediconaspecialmenuforthaticonwillappear,
  152. (ifoneexists).Clickthemainscreentodraw,andtheright
  153. buttontomovetothemenu,thecolourselector,andbacktothe
  154. drawingscreeninturn.Alltheoptionscanbeusedinthisway,
  155. andinthenextsectiontheyarelistedwiththeirpurposeand
  156. theirsub-menus.
  157. Ç
  158. ü2.1ÇêDRAWINGFACILITIES
  159. Ç
  160. êBrushÇ:    Whentheleftbuttonispressedthebrushdrawsonthe
  161. screen.Thebrushsub-menuallowsyoutoselecttheshape
  162. andsizeofthebrush.
  163.  
  164. êSprayÇ:    Whentheleftbuttonishelddownthisoptionwill
  165. paintonthescreenlikeanairbrush.Thespraysub-menu
  166. allowsyoutoselecttheradiusinpixelsofthespray,and
  167. howfastthesprayfillsanarea.1isslowand3isfast.
  168.  
  169. êLineDrawÇ:   Thelinedrawingoptionwilldrawastraightline
  170. betweentwopointsonthescreen.Pointthecrosshairatthe
  171. startpositionandclicktheleftbutton.Nowmovethemouse
  172. towhereyouwantittoend.Alinewillbedraggedout
  173. joiningthepoints.Clicktheleftbuttontodrawtheline,
  174. ortherightbuttontocancelit.Thereisnosubmenufor
  175. linedrawing.
  176.  
  177. êEllipseÇ:  Thisoptionwilldrawacircleorellipseonthe
  178. screen.Clickwhereyouwantthecentretobe,andthenmove
  179. themouseawayfromthispointtodrawanellipse.Click
  180. whenitistherightshape,orpresstherightbuttonto
  181. cancelit.
  182.  
  183. êPaint(Fill)Ç: Thisoptionisusedforfillinginanenclosed
  184. areawiththeworkcolour,orwithamixtureofthework
  185. colourandtheshadecolour,whichwewillcometolater.To
  186. usethefillcan,justclicktheinteriorofanenclosed
  187. shape,anditwillbefilledwithcolour.Thefillsub-menu
  188. showstwocoloursontheright,theworkcolourandthe
  189. shade colour.Inthemiddleisaselectionof8shading
  190. patterns.Clickanyoneofthesetoselectit.
  191. üNote:ÇThefilloptionwillnotfillinanyshapewithshade
  192. ifitisalreadyfilledwitheithertheworkcolourorthe
  193. shadecolour.Youwillhavetofillitwithanothercolour
  194. first.
  195.  
  196. êTextÇ:     Thisoptionallowsyoutoputtextonyourpicture.To
  197. useitpointthecrosshairatwhereyouwantthebottom
  198. left-handedgeofthefirstcharactertobegin.Aline
  199. cursortheheightofthelettersyouareusingwillappear.
  200. Typeyoutextonthekeyboardnormally.Backspacewilllet
  201. youstartagain,undowilltakeyoubacktothecrosshair
  202. mode,andreturnwillputthetextpermanentlyonthe
  203. screen.Thetextsub-menuwillallowyoutoselectoneof
  204. sixtextheights,giveninpixels.Theä'iÇ'andü'bÇ'icons
  205. willselectäitalicÇandüboldÇmodesrespectively.
  206.  
  207. êBlockMoveÇ:    Thisoptionallowsyoutocutarectangularblock
  208. outofthepictureandtopasteitsomewhereelseonthe
  209. screen.Touseitpositionthecrosshairatonecornerof
  210. theblockyouwishtocut,thenpressandholddowntheleft
  211. button.Movethemousetotheoppositecorneroftheblock
  212. youwanttomove,andthenreleasethebutton.Anoutlined
  213. rectanglewillthenallowyoutopositiontheblockonthe
  214. screen.Presstheleftbuttontopastetheblockorthe
  215. rightbuttontoreturntoblockcutmode.Notethatifyou
  216. returntothemenuwithoutcuttinganewblock,theoldone
  217. willbepreserved,andnexttimeyouusetheblockmove
  218. facilityyouwillautomaticallygointoblockpastemode.
  219. Thisallowsanotherpicturetobeloaded,andablockfrom
  220. onepicturetobepastedontoanother.
  221.      Therearetwomodesforblockmove:normalandtranspa⑨
  222. rent.Transparentmodeisselectedonloadingtheprogram,
  223. butyoucanswitchtonormalmodebyclickingtheblockicon
  224. whenitisselected.Theiconwillreflectthisselection.
  225.      Innormalmode,ablockispastedintoplaceis
  226. identicaltotheoriginalblock.Intransparentmode
  227. however,anypartofablockthatisdrawnintheborder
  228. colourwillbetransparentinthepasteoperation.Whatwas
  229. onthescreenfirstwillshowthroughtheseareasofthe
  230. block.Thisisusefulformovingnon-rectangularpictures
  231. aboutthescreen.
  232.  
  233. êMagnifyÇ:  Thisoptionwillenlargeasmallareaofscreenfor
  234. detailedwork.Touseitpositiontherectangleoverthe
  235. areaonwhichyouwanttoworkandpresstheleftbutton.
  236. Theareaintherectanglewillbeenlargedfourtimes.You
  237. candrawonthescreeninthecurrentworkcolourusingthe
  238. leftbutton,orreturntothenormalscreenwiththeright
  239. button.Thereisalsoashortcuttothecolourselector
  240. screenbyclickingthemenubar.Thereisnomagnifysub-
  241. menu.
  242.  
  243. êDiskAccessÇ:   Thisoptionhasnoeffectonthescreen,however
  244. youcanselectthesub-menu.Thefirstoptiononthedisk
  245. menu,thepartiallyshaderectangle,isaclearscreen
  246. facility.Itwillerasethedrawingscreenandsetthe
  247. bordertoblack.
  248.      Thenextthreeoptionsareforloadingpicturesfrom
  249. disk.Theywillload.NEO,.PI1,and.ARTfilesrespecti⑨
  250. vely.The.NEOand.PI1formatsareforloadingpictures
  251. generatedbyothergraphicsprograms,and.ARTisaspecial
  252. formatusedforPaletteMasterpictures.
  253.     Ifyouclickoneoftheseoptionsyouwillbepresented
  254. withtheItemSelectorwindow.Youcanpickafiletoload
  255. eitherbytypingitsname,orbyclickingonitsnameinthe
  256. diskcatalogue.Pressreturnorclickon'OK'toloadthe
  257. file.Thenclickonthescreenandthepicturewillappear.
  258.      Thelasttwooptionsonthismenuareusedtosave
  259. picturesin.ARTand.PRGformatsrespectively.The.ART
  260. formatismostusefulasyoucanreloadandmodifypictures
  261. storedinthisformat.The.PRGformatisanextraoption
  262. whichallowsfinishedpicturestobesavedasprogramfiles
  263. whichcanthenberundirectlyfromtheGEMdesktop,orfrom
  264. otherprograms.
  265.      Selectthefilenametosaveusingthefileselectoras
  266. before.Youwillusuallywanttotypeinanewfilenamewhen
  267. savingpictures,otherwiseyouwilleraseanexisting
  268. picture.
  269. 9[...................................................]011
  270. Ç
  271. ü2.2ÇêTheColourSelectionScreenÇ
  272.  
  273.      Thisscreencanbereachedeitherbypressingtheright
  274. buttonfromamenuscreen,orbyclickingtheenlargescreenmenu
  275. bar.
  276.      OntheleftofthescreenyouwillseetheST'spaletteof
  277. 512colours.Youcanmakeanyoneoftheseintotheworkcolour
  278. simplybypointingthemouseatthecolourandpressingtheleft
  279. button.
  280.      Ontherighthandsideofthisscreenthereareother
  281. facilitiesavailable.Atthetopisaboxcontainingthecurrent
  282. workcolour,whichcanbechangedasdescribedabove.Belowthis
  283. isaboxwhichtellsyoutheRGBvaluesoftheworkcolour.These
  284. describeonascaleof0-7howmuchred,greenandblue
  285. respectivelythereisintheworkcolour.
  286.      Belowthisare4iconswhichaffectcolourchoice.Theyare:
  287.  
  288.           SetScreenBorder        PickColourfromScreen
  289.  
  290.           Optimisepalettes        PickcolourfromAPMpalettes
  291.  
  292.      The'Setscreenborder'iconwillsetthescreenborder
  293. colourtothecurrentworkcolour.Thiswillnotshowuponthe
  294. palettescreen,butchangestheborderaroundtheedgeofthe
  295. pictureonthemaindrawingscreen.
  296.      The'Pickcolourfromscreen'iconallowsyoutopicka
  297. colourfromthosealreadyusedonthescreen.Youwillbeshown
  298. themaindrawingscreen.Clickonthecolouryouwanttoselect,
  299. orpresstherightbuttontoreturntothecolourselection
  300. withoutchoosingacolour.
  301.      The'Optimise'iconwilltelltheAutomaticPaletteManager
  302. tooptimisethesetofcoloursusedonthescreen.Itexamines
  303. thescreenpictureandworksoutwhichcoloursareusedoneach
  304. line.Anyunusedcoloursareflaggedasunallocatedcolours.In
  305. generalyouneedonlyclickitafterloading.NEOor.PI1files.
  306.      The'Pickfrompalettes'iconallowsyoutopickacolour
  307. fromthescreenjustliketheoptionaboveit,howeveritalso
  308. displaystheAPMpalettesdowntherighthandsideofthescreen.
  309. Eachverticalbandrepresentsoneofthe16coloursavailableon
  310. anyscreenline.Lookatthisoptionafterdrawingonthescreen,
  311. andyouwillseethattheAPMbuildsupcoloursfromrightto
  312. left(colour16tocolour1).Thewhitebands(orblackbands
  313. againstalightborder)representunallocatedcolours.The
  314. programwillnotallowyoutoselectoneofthese.
  315.  
  316.      Atthebottomofthiswindowisaboxcontainingthefill
  317. shadingcolour,whichismixedwiththeworkcolourwhenusing
  318. theshadedfillfacility.Ifyouclickthisbox,thenthecurrent
  319. workcolourbecomesthefillshadingcolour.
  320.  
  321.  
  322.  
  323. êRUNNINGOUTOFCOLOURS
  324. Ç     Ifatanytimeyoutrytousemorethan16coloursona
  325. screenline(orpairoflines),thenthecomputerwillringa
  326. belltowarnyou.Itwilldrawasmuchitcan,butwillnot
  327. modifythoselinesonwhichnocoloursareavailable.Sometimes
  328. themousecursorchangescolour,andthismaybeawarningthat
  329. youarerunningoutofcolours.
  330.      Toavoidthissituation,trytore-usecoloursasoftenas
  331. possiblebyusingthe'pickfromscreen'optiondescribedabove.
  332. ü
  333. 2.3ÇêOTHERFACILITIES
  334. Ç
  335.      Therearetwoadditionalfacilitiesavailabletomakethe
  336. programeasiertouse.Theseare:
  337.  
  338. êUndoÇ:     IfyoupresstheUndokey(abovethecursorkeys)
  339. whilstinanydrawingmode,theneverythingyouhavedonetothe
  340. screensinceyoulastusedamenuwillbeerased.Thiscanbe
  341. usedforerasingmistakes.Thisfunctionisnotavailablewhilst
  342. thescreenisenlargedandbehavesslightlydifferentlyintext
  343. mode.Howeveritcanbeusedwhilstpositioningtheenlargebox.
  344.  
  345. êHelpÇ:     IfyoupresstheHelpkeywhilstinanydrawingmode
  346. exceptblockmoveorenlarge,thentheareaofscreenaboutthe
  347. cursorwillbemagnified.Pressingtheleftbuttonwillthen
  348. executetheselecteddrawingfacilityatthepixelpointedtoby
  349. themouse.Therightbuttonwillreturntothenormaldrawing
  350. screen.Inthismanneritispossibletopositionthemouse
  351. accuratelyfordrawing.Thisfacilityisusefulforfilling
  352. smallshapes,oraccuratelycenteringellipses,orjustfor
  353. checkingyourwork.
  354.  
  355. Ç
  356. ü3.ÇêADVANCEDGRAPHICS
  357. Ç
  358.      Thissectionwilltrytomakesomesuggestionsabouthowto
  359. getthebestfromPaletteMaster.
  360.  
  361.      Thefirstthingyoucandotoproducebetterpicturesisto
  362. lookforpictureswithhorizontaldivisions,likethesimple
  363. landscapedescribedintheintroduction.Theprogramonly
  364. allows16coloursonanyoneline,howeverifthepictureis
  365. dividedintohorizontalregionsthendifferentsetsofcolours
  366. canbeusedforeachregion.ThisiswhatPaletteMasterdoes
  367. best,althoughitcaninvariablyimproveotherpicturesaswell.
  368.  
  369.      Secondly,don'tjustaddcolourstoexistingpictures
  370. becausetheyareavailable.Usetheextracoloursfor'touching
  371. up'smallareasofthepicture.Inthiswayitiseasytouse
  372. morethan50coloursinapictureandobtainamuchmorerefined
  373. result.Aparticularapplicationofthisisatechniquecalled
  374. 'edgesoftening',amethodbywhichextracolourscanbeusedto
  375. makeapictureappeartobedrawninamuchhigherresolution.
  376.  
  377.      Whenadiagonallineisdrawonthescreenitappears
  378. jagged,owingtothelimitsoftheST'sresolution.However,we
  379. canfooloureyesintoseeingasmoothedgebyfillinginthe
  380. stepsinadiagonallinewithanintermediatecolour,i.e.one
  381. withRGBvalueshalfwaybetweentheRGBvaluesofthecolours
  382. eithersideoftheedge.Formoreeffectiveresultsseveral
  383. colourscanbeused.Thistechniquehasbeenusedonthedemo
  384. picture'DISCS.ART'.Thediscsintherighthalfofthepicture
  385. havebeen'edgesoftened'.Examinethemwithenlargemodeandyou
  386. willsoongettheidea.
  387.      ThistechniquehaslittleapplicationoutsidePaletteMaster
  388. becausetherearenotenoughcoloursavailable.However,with
  389. PaletteMasteritcanbeusedtogreateffect.
  390.  
  391. 9[...................................................]011
  392. Ç
  393. ü4.ÇêPROGRAMMERS'GUIDE
  394. Ç
  395.      Thefollowingfacilitiesareprovidedfortheuseof
  396. PaletteMasterpicturesinyourownprograms:
  397.  
  398. 1.  Picturesmaybesavedas.PRGfiles,whichyoucanthenuse
  399. frommachinecodewiththeGEMDOSfunctionEXEC.Someversionsof
  400. Chaveafunction'loadex'whichwillloadandexecutea.PRG
  401. filewithouterasingtheexistingprogram.Eitherofthesewill
  402. loadanddisplayapictureuntilakeyispressed,whencontrol
  403. shouldbereturnedtotheoriginalprogram.
  404.  
  405. 2.   Thefile'_PALHBL.USE'canbeusedbyassemblycode
  406. programmerstodisplaypictures.Itcontainstheinterrupt
  407. routinesusedbyPaletteMastertochangethescreenpalette.
  408. ThisshouldallowyoutousePaletteMasterpicturesas
  409. backgroundsforanimation,oryoucanusetheroutinesfor
  410. completelydifferentpurposes.
  411.      Tousethisfile,loaditwiththeGEMDOSfunctionsOPEN,
  412. READ,andCLOSE.TheninassemblycodeexecuteaJSRinstruction
  413. tothefirstaddressinthefile.Thiswillsetupthe68000
  414. traps3-10tocontroltheroutine.UnliketheGEMtraps,
  415. parametersarepassedinregisters.Thetrapsbehaveasfollows:
  416.  
  417. êTRAP #3Ç:  Enabletheinterruptroutines.TheGEMverticalblank,
  418. keyboard,andtimerCinterruptsaredisabled.ThePaletteMaster
  419. VBL,paletteswitching,andkeyboardinterruptsareenabled.
  420. Whilepaletteswitchingisenabledyoushouldavoidall
  421. supervisorcallsexceptthosetotheseroutines.Inparticular
  422. thosecallsdependingontheaboveinterruptswillcrashthe
  423. computer,andmostGEMcallswillbeunusable.
  424.  
  425. êTRAP #4Ç:Disabletheinterruptroutines.ThisrestorestheGEM
  426. interruptstothestatetheywereinbeforetheTRAP#3.
  427.  
  428. êTRAP #5Ç:  Changethecurrentscreenandmulti-paletteaddresses.
  429. Thisallowsapictureanywhereinmemorytobeviewed,aslongas
  430. itstartsona256-bytepageboundary.Thenewscreenbase
  431. addressispassedinA1,andthemulti-paletteaddressinA2.The
  432. constructionofmulti-palettesisexplainedlater.Ifyouloadan
  433. .ARTfile,A1shouldbesettothebaseaddressofthefile,and
  434. A2tothisaddress+32768.
  435.  
  436. êTRAP #6Ç:  Turnonthemousecursor.Themousecursorwillappear
  437. onthescreenandcanbemovedbymovingthemouse.Themouse
  438. cursorwillinitiallybeoff.
  439.  
  440. êTRAP #7Ç:  Turnoffthemousecursor.Themousecursorwill
  441. disappear.Notethattomakethemousere-appearitmustbe
  442. turnedononceforeachtimeitwasturnedoff.
  443.  
  444. êTRAP #8Ç:  Changethemousecursor.Theaddressofthenewmouse
  445. cursorispassedtotheroutineinA1.Thisregistershouldpoint
  446. toastandardGEMspritedefinitionblock,asusedbythe$A00C
  447. and$A00Dopcodes.
  448. Ç
  449. êTRAP #9Ç:  Returnthekeyboardpointers.Callingthisroutinewill
  450. returntwoparametersintheaddressregisters:
  451.      A0:  Thisisthepointertoakeyboardtable.Thebytesof
  452. thistablecontainthescancodes(nottheasciicodes)ofkeys
  453. currentlypressedintheorderthatthewerepressed.Thetable
  454. isterminatedby$ff.Ifthisvalueisthefirstbyteinthe
  455. tablethennokeysarecurrentlypressed.Youcanacknowledgea
  456. keybyreplacingitwith$ffifyoudon'twantittobedetected
  457. again.
  458.      A1:  Thisisapointertothemousetable,whichcontains
  459. threewords.Thefirsttwocontainthemousexandycoordinates
  460. respectively.Bit0ofthethirdwordcontainstherightbutton
  461. status,andbit1theleft.
  462.      A2isalsochanged.
  463.  
  464. êTRAP #10Ç: Playalistofsounds.Apointertoasoundstringis
  465. passedinA1.Thissoundstringshouldhavethesameconstruction
  466. astheXBIOSsoundprimitive,exceptthatcodes128and129are
  467. notimplemented.
  468.  
  469. êTRAP#11Ç: Restorethestatusregister.Ifyoumustmakeacallto
  470. asupervisorroutinethatdoesnotdependontheGEMinterrupts,
  471. thenfollowingitwiththiscallêmayÇpreventproblems.
  472.  
  473. Notethatapartfromtraps3and4,thesecallsonlycorruptA0.
  474.  
  475.  
  476. êMULTI-PALETTESÇ
  477.      Amulti-palettehasthefollowingconstruction:
  478.      Thefirst32bytesshouldcontainthe16colourstobeused
  479. atthetopofthescreen.
  480.      Subsequentblocksof32bytescontainawordwiththeline
  481. onwhichthenextpalettechangeshouldoccur(from1-199),
  482. followedbythenewcolourvaluesforcolours1to15.
  483.      Aterminationvalueof$ffffshouldfollowthefinalblock.
  484.  
  485.      Youshouldnotattempttochangethepaletteontwoadjacent
  486. screenlines,astherewillnotenoughtimeforkeyboard
  487. interruptstooccur,possiblycausingacrash.
  488.      Ifonlytheinitialpaletteandterminationvalueare
  489. includedintheblock,thenthepaletteswitchinginterruptwill
  490. notbeenabled,sotheroutinegivenbelowwillnotwork.Sucha
  491. multi-paletteisdefineduntilyouenableanewonewithTRAP#5.
  492.  
  493.      PaletteMaster.ARTfilesusethefollowingmulti-palette
  494. format.Thetop-of-screenpaletteisfollowedbyanewpalette
  495. foreachevennumberedscreenline,i.e.therenewpalettesfor
  496. lines2,4,6,8....198.Thereforean.ARTfilemulti-palettetakes
  497. up322bytes,includingterminationvalue.PaletteMaster
  498. picturesusethecoloursindescendingorderstartingwithcolour
  499. 15,soifyouwanttousecoloursforspritessetcolours1,2,3
  500. etcfromassemblycodeineachlineonwhichthespriteistobe
  501. used.
  502.  
  503. êWAIT-FOR-VERTICAL-BLANKÇ
  504.      Theroutinegivenbelowwillwaitforaverticalblank
  505. interrupt.Itcanbecalledfromusermode,aslongasamulti-
  506. palettewithatleastonepalettechange(inadditiontothe
  507. initialpalette)isinuse.
  508.  
  509.      waitvbl   move.w  sr,d7
  510.                btst    #9,d7
  511.                beq.s   waitvbl
  512.      waitvbl2move.w  sr,d7
  513.                btst    #9,d7
  514.                bne.s   waitvbl2
  515.                rts
  516.  
  517.  
  518. êEXAMPLEPROGRAM
  519. Ç     Toclarifythissectionanexampleprogramisprovided;
  520. '_EXAMPLE.PRG'whichloadsthepicture'_DISCS.ART'anddisplays
  521. itonthescreenwiththemousecursoruntilakeyispressed.
  522. Theassemblycodeforthissimpleprogramisincludedbelow:
  523.  
  524.         section example
  525.  
  526. *       *       *       *       *       *       *       *       *       *
  527.  
  528. start   move.w  #2,-(sp)                ; find current base of screen
  529.         trap    #14
  530.         addq.l  #2,sp
  531.         lea     gemscrn,a0              ; and store it
  532.         move.l  d0,(a0)
  533.  
  534.         lea     filenm1,a4              ; load _PALHBL.USE
  535.         move.l  #$60000,a5
  536.         move.l  #$800,a6
  537.         bsr.s   open
  538.         jsr     $60000                  ; set up traps
  539.  
  540.         lea     filenm2,a4              ; load DISCS.ART
  541.         move.l  #$68000,a5              ; address
  542.         move.l  #$9000,a6               ; length
  543.         bsr.s   open
  544.  
  545.         trap    #3                      ; enable routines
  546.         move.l  #$68000,a1              ; base of picture
  547.         move.l  #$70000,a2              ; base of multi-palette
  548.         trap    #5                      ; show picture
  549.         trap    #6                      ; turn on mouse
  550.  
  551.         trap    #9                      ; get keyboard pointers
  552. waitkey tst.b   (a0)                    ; wait for a key
  553.         bmi.s   waitkey
  554.  
  555. done    move.l  gemscrn,a1              ; restore gem screen and
  556.         lea     default,a2              ; a one line palette
  557.         trap    #5
  558.         moveq   #-1,d0                  ; wait for a while until
  559. waitpal dbra    d0,waitpal              ; for new palette to appear
  560.         trap    #4                      ; disable routines
  561.  
  562.         clr.w   -(sp)                   ; end program
  563.         trap    #1
  564.  
  565. Ç*       *       *       *       *       *       *       *       *       *
  566.  
  567. open    clr.w   -(sp)                   ; open picture file
  568.         move.l  a4,-(sp)                ; a4 -> filename
  569.         move.w  #$3d,-(sp)
  570.         trap    #1
  571.         addq.l  #8,sp
  572.         tst.w   d0
  573.         bmi.s   diskerr
  574.         move.w  d0,-(sp)                ; store file handle
  575.  
  576. read    move.l  a5,-(sp)                ; read pic to data area
  577.         move.l  a6,-(sp)
  578.         move.w  d0,-(sp)
  579.         move.w  #$3f,-(sp)
  580.         trap    #1
  581.         add.w   #12,sp
  582.  
  583. close   move.w  #$3e,-(sp)              ; close pic file
  584.         trap    #1                      ; handle already on stack
  585.         addq.l  #4,sp
  586. diskerr rts
  587.  
  588. *       *       *       *       *       *       *       *       *       *
  589.  
  590. picbase dc.l    0
  591. gemscrn dc.l    0
  592. filenm1 dc.b    'A:_PALHBL.USE',0
  593. filenm2 dc.b    'A:DISCS.ART',0
  594. default dc.w    $777,$700,$070,$770,$007,$707,$077,$555
  595.         dc.w    $333,$733,$373,$773,$337,$737,$377,$000
  596.         dc.w    -1
  597.  
  598. *       *       *       *       *       *       *       *       *       *
  599.  
  600.         end
  601.  
  602.  
  603.